package 面试真题;

import java.util.Scanner;

public class Ali204 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = scanner.nextInt();
        int y = scanner.nextInt();
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        if (x * b < a) System.out.println("0 0");
        else {
            if (a > b) {
                int p = x * b / a;
                if (p <= y) {
                    System.out.println(p * a / b + " " + p);
                } else {
                    System.out.println(y * a / b + " " + y);
                }
            }else{
                int p = y * a / b;
                if (p <= x) {
                    System.out.println(p * b / a + " " + p);
                } else {
                    System.out.println(x * b / a + " " + x);
                }
            }
        }

    }
}
